<?php
/**@package     Joomla.Site
 * @subpackage  mod_booking
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt*/
defined('_JEXEC') or die;
$type   = $params->get('type', 0);
if($type==0){
?>
<script type="text/javascript" src="templates/protostar/js/jquery-1.7.1.min.js"></script>

<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>

<div id="map_canvas" style=""><div id="map"><span style="color:Gray;">Loading map...</span></div></div><!-- Map Ends display -->		
<script type="text/javascript">
var locations = [
['<div class=info><h4>WMC Tower</h4><img src=http://wmctower.com/office/templates/myfair/images/logo.png><div class="contentmap">102A-B-C Cong Quynh Street, Pham Ngu Lao Ward, District 1, HCMC</div></div>', 10.765064, 106.690811],
['<div class=info><h4>Co.op Mart Cong Quynh</h4><div class="contentmap introtext">189C Cong Quynh, Dist 1, HCMC</div></div>', 10.767523,106.6862888],
['<div class=info><h4>Ben Thanh Market</h4><div class="contentmap introtext">Le Loi, Dist 1, HCMC</div></div>', 10.7725662,106.6979917],
['<div class=info><h4>Pham Ngu Lao Area</h4><div class="contentmap introtext">Pham Ngu Lao Street, Dist 1, HCMC</div></div>', 10.767644, 106.690773],
['<div class=info><h4>Nguyen Hue Boulevard</h4><div class="contentmap introtext">78 Nguyen Hue, Dist 1, HCMC</div></div>', 10.774847, 106.702824],
['<div class=info><h4>Zen Plaza Shopping Center</h4><div class="contentmap introtext">49 Nguyen Trai, Dist 1, HCMC</div></div>', 10.770525, 106.692128],
['<div class=info><h4>Now Zone Shopping Center</h4><div class="contentmap introtext">235 Nguyen Van Cu, Dist 1, HCMC</div></div>', 10.764283, 106.682792],
['<div class=info><h4>UnionSquare</h4><div class="contentmap introtext">171 Dong Khoi, Ben Nghe, Dist 1, HCMC</div></div>', 10.776403, 106.702641],
['<div class=info><h4>Galaxy Cinema Nguyen Du</h4><div class="contentmap introtext">116 Nguyen Du, Dist 1, HCMC</div></div>', 10.772962,106.693704],
['<div class=info><h4>Galaxy Cinema Nguyen Trai</h4><div class="contentmap introtext">230 Nguyen Trai, Dist 1, HCMC</div></div>', 10.764516,106.68722],
['<div class=info><h4>September 23rd Park</h4><div class="contentmap introtext"> Le Lai, Pham Ngu Lao, Dist 1, HCMC</div></div>', 10.769475, 106.693398],
['<div class=info><h4>Tao Dan Park</h4><div class="contentmap introtext">55C Nguyen Thi Minh Khai, Dist 3, HCMC</div></div>', 10.7743726,106.6925157],
['<div class=info><h4>Citimart Citi Plaza</h4><div class="contentmap introtext">230 Nguyen Trai, Dist 1, HCMC</div></div>', 10.76428,106.687466],
['<div class=info><h4>Tu Du Hospital</h4><div class="contentmap introtext">284 Cong Quynh, Dist 1, HCMC</div></div>', 10.767971,106.685325],
['<div class=info><h4>Van Lang University</h4><div class="contentmap introtext">45 Nguyen Khac Nhu, Dist 1, HCMC</div></div>', 10.7629116,106.6933694],
['<div class=info><h4>Dental Hospital</h4><div class="contentmap introtext">263 Tran Hung Dao, Dist 1, HCMC</div></div>', 10.7617483,106.6907443],
['<div class=info><h4>Viet My Aesthtic Hospital</h4><div class="contentmap introtext">331 Nguyen Trai, Dist 1, HCMC</div></div>', 10.7611369,106.6849722],
];
    // Setup the different icons and shadows
    var iconURLPrefix = 'http://wmctower.com/mayfair/templates/protostar/images/iconmap/';
    var icons = [  
	  iconURLPrefix + 'icon_mayfair.png',
      iconURLPrefix + 'supermarket.png',
      iconURLPrefix + 'cathedral2.png',
      iconURLPrefix + 'street.png',
	  iconURLPrefix + 'street.png',
      iconURLPrefix + 'shoppingmall.png',
      iconURLPrefix + 'shoppingmall.png',
      iconURLPrefix + 'shoppingmall.png',   
      iconURLPrefix + 'cinema.png',  
      iconURLPrefix + 'cinema.png',
	  iconURLPrefix + 'park.png',
	  iconURLPrefix + 'park.png', 
      iconURLPrefix + 'supermarket.png',
      iconURLPrefix + 'firstaid.png',
      iconURLPrefix + 'school.png',
      iconURLPrefix + 'firstaid.png',
      iconURLPrefix + 'firstaid.png',
    ]
    var icons_length = icons.length;
    var shadow = {
      anchor: new google.maps.Point(5,13),
      url: iconURLPrefix + 'msmarker.shadow.png'
    };
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom:17,
      center: new google.maps.LatLng(10.765022, 106.691078),
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      mapTypeControl: false,
      streetViewControl: false,
	  disableDefaultUI: true,
      panControl: false,
	  zoomControl: true
      //zoomControlOptions: {position: google.maps.ControlPosition.LEFT_BOTTOM}
    });
    var infowindow = new google.maps.InfoWindow({
      maxWidth:745,
	  maxHeight:600
    });
    var marker;
    var markers = new Array();
    var iconCounter = 0;
    // Add the markers and infowindows to the map
    for (var i = 0; i < locations.length; i++) {  
      marker = new google.maps.Marker({
        position: new google.maps.LatLng(locations[i][1], locations[i][2], locations[i][3], locations[i][4], locations[i][5]),
        map: map,
        icon : icons[iconCounter],
        shadow: shadow
      });
      markers.push(marker);
      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
          infowindow.setContent(locations[i][0]);
          infowindow.open(map, marker);
        }
      })(marker, i));
      iconCounter++;
      if(iconCounter >= icons_length){
      	iconCounter = 0;
      }
    }
    function mapclick(sott){
		marker = new google.maps.Marker({
			position: new google.maps.LatLng(locations[sott][1],locations[sott][2]),
			map: map,
			icon : icons[sott],
			shadow: shadow
		});
		markers.push(marker);
		infowindow.setContent(locations[sott][0]);
		infowindow.open(map, marker);
    };
    function AutoCenter() {
		var bounds = new google.maps.LatLngBounds();
		$.each(markers, function (index, marker) { bounds.extend(marker.position);});
		map.fitBounds(bounds);
    }
    AutoCenter();
  </script> 
<?php
}
if($type==1){

}
?>